<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var str = "i love javascript very much";
        var arr = str.split(" ");   //arr=["i", "love", "javascript", "very", "much"]
        // console.log(arr);
        for (var i = 0; i <= arr.length - 1; i++) {
            var arr1 = arr[i].split("");
            arr1[0] = arr1[0].toUpperCase();
            arr[i] = arr1.join("");
        }
        str = arr.join(" ");
        console.log(str);
    </script>
</head>
<body>
    
</body>
</html>